﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace LINQtoLDAPDemo_ConnectionPoolExample
{
    public class GroupMapping : LinqToLdap.Mapping.ClassMap<Group>
    {
        public override LinqToLdap.Mapping.IClassMap PerformMapping(string namingContext = null, string objectCategory = null, bool includeObjectCategory = true, IEnumerable<string> objectClasses = null, bool includeObjectClasses = true)
        {
            NamingContext(string.Format("CN=Groups,{0}", ConfigurationManager.AppSettings["ldapPartition"]));
            ObjectCategory("group");

            Map(g => g.Name).Named("displayName");
            Map(g => g.Description);
            Map(g => g.Members).Named("member");

            DistinguishedName(g => g.DistinguishedName);

            return this;
        }
    }
}
